﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="recordlist.aspx.cs" Inherits="UI.system.page.active.recordlist" %>
<%@ Import Namespace="Common" %>
<style>
table td img{width:50px; height:50px; border-radius:25px;}
</style>
<div style="margin: 15px;">
    <div style="padding-bottom:15px; float:left;">
    <div class="lefts"><input id="keyword" class="layui-input lefts"  placeholder="请输入昵称"/></div>
    <div class="lefts" style="margin-left:10px;"><a id="search" class="layui-btn layui-btn-small layui-btn-normal lefts" onclick="Search()">搜索</a></div>
    </div>
    <table class="layui-table">
    <colgroup>
      <col width="80">
      <col>
      <col width="100">
      <col width="100">
      <col width="80">
      <col width="120">
      <col width="100">
      <col width="110">
      <col width="100">
    </colgroup>
    <thead>
      <tr>
        <th>头像</th>
        <th>昵称</th>
        <th>省份</th>
        <th>城市</th>
        <th>性别</th>
        <th>红包金额</th>
        <th>状态</th>
        <th>时间</th>
        <th>操作</th>
      </tr>
    </thead>
     <tbody id="layer-table">
        <tr><td colspan="8" class="center">数据加载中...</td></tr>
    </tbody>
    <script id="data-table" type="text/html">
      {{#  layui.each(d, function(index, item){ }}
      <tr>
        <td><img src="{{item.HeadImg}}" /></td>
        <td>{{item.NickName}}</td>
        <td>{{item.Province}}</td>
        <td>{{item.City}}</td>
        <td>{{item.Sex.ToSex()}}</td>
        <td>{{item.Money}}</td>
        <td>{{item.IsAuto==0?"<font class='red'>未发放</font>":"<font class='green'>已发放</font>"}}</td>
        <td>{{item.CreateDate}}</td>
        <td>
            {{# if(item.IsAuto==0){ }}
            <a class="layui-btn layui-btn-mini layui-btn-danger" onclick="Set_IsAuto(this,{{item.ID}})">发放</a>
            {{# } }}
        </td>
      </tr>
      {{#  }); }}
      </script>
  </table>
  <div id="layer-page" class="layer-page" style="left:0px; bottom:0px;"></div>
</div>
<script>
    function Init_Pager(pageindex) {
            var data = {};
            data.act = "Find_PrizeRecord";
            data.keyword = $("#keyword").val();
            data.id = '<%=Request["id"] %>';
            data.pageindex = pageindex;
            data.sign = GetSign(data.act);
            Loading();
            Ajax.Post("/tools/Admin.ashx", data, function (r) {
                var json = $.parseJSON(r);
                if (json.state) {
                    Pager(json.data.list, json.data.count);
                }
                else {
                    LayerBox.Error(json.msg);
                }
            });
        };
        Init_Pager(1);

        function Set_IsAuto(o, id) {
            LayerBox.Confirm("您确定要发放吗？", function () {
                var data = {};
                data.act = "Set_IsAuto";
                data.id = id;
                data.sign = GetSign(data.act);
                var index = LayerBox.Loading();
                Ajax.Post("/tools/Admin.ashx", data, function (r) {
                    LayerBox.Close.ByIndex(index);
                    var json = $.parseJSON(r);
                    if (json.state) {
                        $(o).parent().prev().prev().html("<font class='green'>已发放</font>");
                        $(o).remove();
                    }
                    else {
                        LayerBox.Error(json.msg);
                    }
                });
            });
        };


</script>